//
//  AttendanceView.m
//  SchoolTask
//
//  Created by feel on 16/8/25.
//  Copyright © 2016年 sm. All rights reserved.
//

#import "AttendanceView.h"
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height

@interface AttendanceView ()

@property (nonatomic,retain) UILabel *DateLb;      //顶部显示日期
@property (nonatomic,retain) UILabel *timeLb;      //顶部显示时间
@property (nonatomic,retain) UILabel *classLb;     //课程名称
@property (nonatomic,retain) UILabel *addressLb;   //显示上课地址按钮
@property (nonatomic,retain) UIImageView *addressImage; //展示地点图片
@property (nonatomic,retain) UIImageView *nameImage;    //展示姓名按钮
@property (nonatomic,retain) UILabel *nameLb;           //显示姓名
@property (nonatomic,retain) UILabel *attendanceNub;    //展示文本 出勤人数
@property (nonatomic,retain) UILabel *attendanceInfo;   //显示具体出勤人数
@property (nonatomic,retain) UILabel *attendanceLb;     //显示签到是否成功
@property (nonatomic,retain) UILabel *attendance;       //显示具体签到原因
@property (nonatomic,retain) UILabel *presentation;     //展示温馨提示
@property (nonatomic,retain) UILabel *presentationInfo; //显示温馨提示语
@property (nonatomic,retain) UILabel *reasonLb;         //原因说明
@property (nonatomic,retain) UILabel *reasonInfo;       //原因说明信息
@property (nonatomic,retain) UIImageView *reasonImage;  //签到失败照片
@property (nonatomic,retain) UIButton *AddImageBt;      //添加图片按钮

@property (nonatomic,retain) UILabel  *select;          //情况选择
@property (nonatomic,retain) UILabel  *selectReason1;
@property (nonatomic,retain) UILabel  *selectReason2;
@property (nonatomic,retain) UIImageView *selectReasonIm1;
@property (nonatomic,retain) UIImageView *selectReasonIm2;
@property (nonatomic,retain) UILabel  *sReason1;
@property (nonatomic,retain) UILabel  *sReason2;

@property (nonatomic,retain) UIView  *reasonView;       //承载底部框内控件

@property (nonatomic,retain) UILabel *lineLb1;           //细线
@property (nonatomic,retain) UILabel *lineLb2;
@property (nonatomic,retain) UILabel *lineLb3;
@property (nonatomic,retain) UILabel *lineLb4;

@property (nonatomic,retain) UIButton *submitBt;        //提交按钮
@property (nonatomic,retain) UIImageView *selectImage;  //选择提交的图片

@end

@implementation AttendanceView

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        CGRect rect = [UIScreen mainScreen].bounds;
        rect.origin.y = 25;
        self.frame = rect;
        [self setController];
    }
    return self;
}

- (void)setController {
    
//    _submitBt = [UIButton buttonWithType:UIButtonTypeCustom];
//    [_submitBt setTitle:@"提交" forState:UIControlStateNormal];
//    [_submitBt addTarget:self action:@selector(submitBtAction) forControlEvents:UIControlEventTouchUpInside];
//    _submitBt.titleLabel.textColor = [UIColor whiteColor];
//    _submitBt.backgroundColor = [UIColor colorWithRed:250/255.0 green:140/255.0 blue:5/255.0 alpha:1];
//    
//    _AddImageBt = [UIButton buttonWithType:UIButtonTypeSystem];
//    [_AddImageBt addTarget:self action:@selector(AddImageBtAction) forControlEvents:UIControlEventTouchUpInside];
//    [_AddImageBt setBackgroundImage:[UIImage imageNamed:@"添加图片"] forState:UIControlStateNormal];
    
    //    414 320  736 480
    CGFloat w = 414 / kScreenW;
    CGFloat h = 736 / kScreenH;
    
    _lineLb1    = [[UILabel alloc]initWithFrame:CGRectMake(0, 110/h, 1000, 1)];
    _lineLb2    = [[UILabel alloc]initWithFrame:CGRectMake(0, 215/h, 1000, 1)];
    _lineLb3    = [[UILabel alloc]initWithFrame:CGRectMake(0, 170/h, 1000, 1)];
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(40, (1920-620)/3/h, 34/w, 26/h)];
    imageView.image = [UIImage imageNamed:@"照相机"];
    [self addSubview:imageView];
    _lineLb4 = [[UILabel alloc]initWithFrame:CGRectMake(80, 450/h, kScreenW-90/w, 1)];
    _lineLb4.backgroundColor = [UIColor colorWithRed:190/255.0 green:190/255.0 blue:190/255.0 alpha:1];
    _lineLb3.backgroundColor = [UIColor colorWithRed:190/255.0 green:190/255.0 blue:190/255.0 alpha:1];
    _lineLb2.backgroundColor = [UIColor colorWithRed:190/255.0 green:190/255.0 blue:190/255.0 alpha:1];
    _lineLb1.backgroundColor = [UIColor colorWithRed:190/255.0 green:190/255.0 blue:190/255.0 alpha:1];
    
    _reasonView   = [[UIView alloc]initWithFrame:CGRectMake(10/w, 220/h, (kScreenW - 20/w), (kScreenH - 290/h))];
    _addressImage = [[UIImageView alloc]initWithFrame:CGRectMake(31/w, 434/3/h, 25/w, 30/h)];
    _selectImage  = [[UIImageView alloc]initWithFrame:CGRectMake(50/w, 500/h, 93/w, 60/h)];
    _submitBt.frame   = CGRectMake(160/w, 650/h, 70/w, 30/h);
    _AddImageBt.frame = CGRectMake(160/w, 510/h, 50/w, 40/h);
    
    //设置view的边框
    _reasonView.layer.cornerRadius = 10;
    _reasonView.layer.borderWidth  = 1;
    _selectImage.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1];
    
    _DateLb     = [[UILabel alloc]initWithFrame:CGRectMake(32/w, 75/h, 100/w, 30/h)];
    _timeLb     = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW - 150)/w, 75/h, 100/w, 30/h)];
    _classLb    = [[UILabel alloc]initWithFrame:CGRectMake(32/w, 110/h, 300/w, 50/h)];
    _addressLb  = [[UILabel alloc]initWithFrame:CGRectMake(154/3/w, 434/3/h, 100/w, 30/h)];
    _nameLb     = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW - 200/w), 434/3/h, 74/w, 30/h)];
    _reasonLb   = [[UILabel alloc]initWithFrame:CGRectMake(32/w, (1920-890)/3/h, 200/w, 50/h )];
    
    _reasonInfo = [[UILabel alloc]initWithFrame:CGRectMake(110/w, (1920-790)/3/h, 100/w, 50/h)];
    _attendanceNub  = [[UILabel alloc]initWithFrame:CGRectMake(104/3/w, 530/3/h, 100/w, 50/h)];
    _attendanceInfo = [[UILabel alloc]initWithFrame:CGRectMake(110/w, 530/3/h, 100/w, 50/h)];
    _attendanceLb   = [[UILabel alloc]initWithFrame:CGRectMake(32/w, 651/3/h, 100/w, 50/h)];
    _attendance     = [[UILabel alloc]initWithFrame:CGRectMake(100/w, 651/3/h, 100/w, 50/h)];
    _presentation   = [[UILabel alloc]initWithFrame:CGRectMake(32/w, 712/3/h, 100/w, 50/h)];
    _presentationInfo = [[UILabel alloc]initWithFrame:CGRectMake(120/w, 712/3/h, 100/w, 50/h)];
    _select = [[UILabel alloc]initWithFrame:CGRectMake(32/w, 810/3/h, 100/w, 50/h)];
    _selectReasonIm1 = [[UIImageView alloc]initWithFrame:CGRectMake(95/w, 856/3/h, 20/w, 20/h)];
    _selectReasonIm2 = [[UIImageView alloc]initWithFrame:CGRectMake(95/w, 946/3/h, 20/w, 20/h)];
    _selectReasonIm1.image = [UIImage imageNamed:@"批准"];
    _selectReasonIm2.backgroundColor = [UIColor colorWithRed:116/255.0 green:200/255.0 blue:78/255.0 alpha:1];
    
    _selectReasonIm1.layer.shouldRasterize = YES;
    _selectReasonIm1.layer.cornerRadius = 10;
    _selectReasonIm1.layer.masksToBounds = YES;
    
    _selectReasonIm2.layer.shouldRasterize = YES;
    _selectReasonIm2.layer.cornerRadius = 10;
    _selectReasonIm2.layer.masksToBounds = YES;
    
    _selectReason1 = [[UILabel alloc]initWithFrame:CGRectMake(120/w, 810/3/h, 100/w, 50/h)];
    _selectReason2 = [[UILabel alloc]initWithFrame:CGRectMake(120/w, 903/3/w, 100/w, 50/h)];
    _sReason1      = [[UILabel alloc]initWithFrame:CGRectMake(110/w, 852/3/h, 300/w, 50/h)];
    _sReason2      = [[UILabel alloc]initWithFrame:CGRectMake(110/w, 948/3/h, kScreenW-160/w, 50/h)];
    _nameImage = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW - 220/w), 434/3/h, 18/w, 30/h)];
    
    _nameImage.image    = [UIImage imageNamed:@"姓名图标"];
    _addressImage.image = [UIImage imageNamed:@"位置图标"];
    _DateLb.text  = @"2016.10.10";
    _timeLb.text  = @"09:00";
    _classLb.text = @"语文";
    
    _selectReason1.text = @"我上课了";
    _selectReason2.text = @"我要请假";
    _select.text  = @"情况选择";
    _sReason1.text = @"实际定位不准、手机忘带、手机没电、网络有问题";
    _sReason2.text = @"身体不舒适、病假、事假......如果实际未上课有未请假，会记为旷课";
    _selectReason1.text = @"我上课了";
    _nameLb.text        = @"三米";
    _addressLb.text     = @"中天国际";
    _attendanceNub.text = @"出勤人数";
    
    _attendanceNub.font = [UIFont fontWithName:@"MicrosoftYaHei-Bold" size:35.79/2/w];
    _classLb.font = [UIFont fontWithName:@"MicrosoftYaHei-Bold" size:17/w];
    
    _attendanceLb.text  = @"签到失败";
    _attendanceLb.font  = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    _select.font  = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    
    _sReason2.font = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    _selectReason1.font  = [UIFont fontWithName:@"MicrosoftYaHei" size:12/w];
    _selectReason2.font  = [UIFont fontWithName:@"MicrosoftYaHei" size:12/w];
    _sReason1.font      = [UIFont fontWithName:@"MicrosoftYaHei" size:10/w];
    _sReason2.font      = [UIFont fontWithName:@"MicrosoftYaHei" size:10/w];
    
    _attendance.text    = @"不在指定区域";
    _attendance.font    = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    _presentation.text  = @"温馨提示";
    _presentation.font  = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    _reasonLb.text      = @"原因说明";
    _reasonLb.font      = [UIFont fontWithName:@"MicrosoftYaHei" size:14/w];
    _reasonInfo.text    = @"那是滴静安寺欧吉桑";
    _reasonInfo.font    = [UIFont fontWithName:@"MicrosoftYaHei" size:12/w];
    _reasonInfo.font    = [UIFont fontWithName:@"MicrosoftYaHei" size:12/w];
    _addressLb.font     = [UIFont fontWithName:@"MicrosoftYaHei" size:15/w];
    _nameLb.font        = [UIFont fontWithName:@"MicrosoftYaHei" size:15/w];
    _attendanceInfo.font = [UIFont fontWithName:@"MicrosoftYaHei" size:15/w];
    
    _reasonInfo.text = @"你好是奇偶if技术的";
    _reasonInfo.font = [UIFont fontWithName:@"MicrosoftYaHei" size:12];
    _presentationInfo.text = @"觉撒哈就爱速递易";
    _presentationInfo.font = [UIFont fontWithName:@"MicrosoftYaHei" size:12/w];
    
    _attendanceInfo.text   = @"20/60";
    
    _DateLb.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _reasonInfo.textColor = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _timeLb.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _classLb.textColor    = [UIColor colorWithRed:250/255.0 green:140/255.0 blue:0 alpha:1];
    _nameLb.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _addressLb.textColor  = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _reasonLb.textColor   = [UIColor colorWithRed:250/255.0 green:140/255.0 blue:0 alpha:1];
    _attendance.textColor = [UIColor colorWithRed:255/255.0 green:138/255.0 blue:0 alpha:1];
    _presentationInfo.textColor   = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _reasonView.layer.borderColor = [[UIColor colorWithRed:190/255.0 green:190/255.0 blue:190/255.0 alpha:1] CGColor];
    _attendanceLb.textColor   = [UIColor colorWithRed:250/255.0 green:140/255.0 blue:0 alpha:1];
    _presentation.textColor   = [UIColor colorWithRed:250/255.0 green:140/255.0 blue:0 alpha:1];
    _attendanceNub.textColor  = [UIColor colorWithRed:255/255.0 green:139/255.0 blue:0 alpha:1];
    _attendanceInfo.textColor = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    
    _select.textColor     = [UIColor colorWithRed:255/255.0 green:139/255.0 blue:0 alpha:1];
    _selectReason2.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _selectReason1.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    
    _sReason2.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    _sReason1.textColor     = [UIColor colorWithRed:170/255.0 green:170/255.0 blue:170/255.0 alpha:1];
    
    [self addSubview:_reasonView];
    [self addSubview:_DateLb];
    
    [self addSubview:_timeLb ];
    
    [self addSubview:_classLb];
    
    [self addSubview:_addressLb];
    
    [self addSubview:_nameLb];
    [self addSubview:_attendanceNub ];
    [self addSubview:_attendanceInfo];
    [self addSubview:_attendanceLb];
    [self addSubview:_attendance];
    [self addSubview:_presentation];
    [self addSubview:_presentationInfo];
    [self addSubview:_reasonLb];
    [self addSubview:_reasonInfo];
    [self addSubview:_lineLb3];
    [self addSubview:_lineLb2];
    [self addSubview:_lineLb1];
    [self addSubview:_addressImage];
    [self addSubview:_nameImage];
    [self addSubview:_AddImageBt];
//    [self addSubview:_submitBt];
//    [self addSubview:_selectImage];
    [self addSubview:_lineLb4];
    [self addSubview:_select];
    [self addSubview:_selectImage];
    [self addSubview:_selectReason1];
    [self addSubview:_selectReason2];
    [self addSubview:_selectReasonIm1];
    [self addSubview:_selectReasonIm2];
    [self addSubview:_sReason1];
    [self addSubview:_sReason2 ];
    
    
    
}




- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    NSLog(@"tuoch");
    [self.delegate jump];
}

@end
